<%@page import="com.bill.common.system.service.ITransactionRecordService"%>
<%@page import="com.bill.common.business.dto.SellQueryDTO"%>
<%@page import="com.bill.common.business.service.ISellService"%>
<%@page import="com.sinba.common.dto.PageDTO"%>
<%@page import="com.bill.common.user.dto.AccountDTO"%>
<%@page import="com.bill.common.user.service.IAccountService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
if(session.getAttribute("password2")==null){
	/* response.sendRedirect( "login2.jsp?pageUrl=user/myBuy.jsp");
	return; */
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
ISellService sellService = (ISellService)ac.getBean("sellService");
SellQueryDTO qdto = new SellQueryDTO();
qdto.setBuyUser((String)session.getAttribute("loginName"));
int pages = 1;
String sidx = "createTime";
String sord="desc";
if(request.getParameter("pages")!=null && request.getParameter("_pages")!=""){
	pages = Integer.parseInt(request.getParameter("pages"));
}
int rows = 10;
int start = ( pages - 1 ) * rows;
qdto.setStart( start );
qdto.setLimit( rows );
PageDTO pageDTO = sellService.findSellPage(qdto, sord, sidx);
if(pageDTO!=null){
	pageDTO.setPage( pages );
	pageDTO.setRows( rows );
}
request.setAttribute("pageDTO",pageDTO);
request.setAttribute("pageUrl","myBuy.jsp?");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title><fmt:message key="i18n.title"/> </title>
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	
	<link rel="shortcut icon" href="../index/favicon.png" />
	
	<!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />
    
	<!-- this page specific styles -->
    <link rel="stylesheet" href="css/compiled/tables.css" type="text/css" media="screen" />
	 
	<link rel="stylesheet" href="../styles/myStyle.css" />
</head>
<body>
	
	<!-- main container -->
	<div class="content container-fluid">
		<!-- BreadcrumbNavigation -->
        <div class="row-fluid head">
            <div class="span12">
                <h4><fmt:message key="i18n.tradeMg" />&gt; 我的买入</h4>
            </div>
        </div>
        <!-- End BreadcrumbNavigation -->
        
        <!-- list table -->
        <div class="table-wrapper orders-table section">
			<div class="row-fluid">
				<table class="table table-hover">
					<thead>
						<tr>
				        	<th scope="col"><fmt:message key="i18n.memberNumber" /></th>
							<th scope="col"><fmt:message key="i18n.acceptBuyMoney" /></th>
							<th scope="col"><fmt:message key="i18n.status" /></th>
							<th scope="col"><fmt:message key="i18n.aid.createData" /></th>
							<th scope="col">买入时间</th>
							<th scope="col">联系方式</th>
							<th scope="col">姓名</th>
							<th scope="col">开户银行</th>
							<th scope="col">银行账户</th>
						</tr>
					</thead>
                    <tbody>
						<c:forEach items="${pageDTO.data}" var="data">
							<tr>
								<td>${data.sellUser }</td>
								<td>${data.sellMoney }</td>
								<td>
								<c:choose>
								 
								    <c:when test="${data.status eq 1}"> 
									   <span style="color:#008AD4;"><fmt:message key="i18n.Matched" /></span>
								   </c:when>
								   <c:when test="${data.status eq 2}"> 
									    <span style="color:green;"><fmt:message key="i18n.tranSuccess" /></span>
								   </c:when>
								   <c:when test="${data.status eq 3}"> 
								   		<span style="color:red;"><fmt:message key="i18n.cleaned" /></span>
								   </c:when>
								   <c:otherwise>
									   <span style="color:blue;"><fmt:message key="i18n.Queue" /></span>
								   </c:otherwise>
								</c:choose>
								</td>
								
								<td><fmt:formatDate value="${data.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td><fmt:formatDate value="${data.matchTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td>${data.sellMobile}</td>
								<td>${data.sellUserName}</td>
								<td>${data.sellAccountType}</td>
								<td>${data.sellBankAccount}</td>
							</tr>
			   			</c:forEach>
						<c:if test="${empty pageDTO.data}">
						<tr>
							<td colspan="9" style="text-align: center;"><fmt:message key="i18n.noData"/></td>
						</tr>
						</c:if> 
                    </tbody>
				</table>
			</div>
			<div class="pagination">
				<ul>
		            <li><a href="${pageUrl }&pages=${pageDTO.page-1}">&#8249;</a></li>
		            <li><a <c:if test="${pageDTO.page eq 1}"> class="active" </c:if> href="${pageUrl }&pages=1">1</a></li>
		            <c:if test="${pageDTO.total ge 2}">
		            <li><a <c:if test="${pageDTO.page eq 2}"> class="active" </c:if> href="${pageUrl }&pages=2">2</a></li>
		            </c:if>
		            <c:if test="${pageDTO.total ge 2}">
		            <li><a <c:if test="${pageDTO.page eq 3}"> class="active" </c:if> href="${pageUrl }&pages=3">3</a></li>
		            </c:if>
		            <c:if test="${pageDTO.total ge 2}">
		            <li><a <c:if test="${pageDTO.page eq 4}"> class="active" </c:if> href="${pageUrl }&pages=4">4</a></li>
		            </c:if>
		            <li><span style="font-size: 10px;"> ${pageDTO.page}/${pageDTO.total} | <fmt:message key="i18n.total"/>${pageDTO.totalSize} </span></li>
		            <li><a href="${pageUrl }&pages=${pageDTO.page+1}">&#8250;</a></li>
		            
		            
	          	</ul>
	          	
	        </div>
		</div>
        <!-- end list table -->
        
	</div>
  	
  	<form id="sellClean_form" action="registerUser!userOpt.action" method="post">
  		<input type="hidden" name="pageUrl" value="myBuy.jsp" />
	 	<input type="hidden" name="optType" value="MaiChuClean" />
  	</form>
  	
  	<form id="confirmPayment_form" action="registerUser!userOpt.action" method="post">
  		<input type="hidden" name="pageUrl" value="myBuy.jsp" />
	 	<input type="hidden" name="optType" value="ConfirmPayment" />
  	</form>
  	
	<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="../scripts/user/sell.js"></script>
</body>
</html>